package XingHuoTest_2024_3_2;

import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();

        System.out.println("请输入n个整数");
        int[]n1=new int[n];
        for (int i = 0; i < n; i++) {
            int num=sc.nextInt();
            if(num>=1&&num<=5000){
               n1[i]=num;
            }else{
                System.out.println("你输入的证书不在1到5000之内");
                i-=1;
            }
        }
        int max=n1[0];
        int temp;
        for (int i = 1; i < n1.length; i++) {
            if(max>n1[i]){
            }else{
                temp=n1[i];
                n1[i]=max;
                max=temp;
            }
        }
        int[]m1=new int[m];
        for (int i = 0; i < m; i++) {
            int num1=sc.nextInt();
            if (num1>=1&&num1<=5000){
                m1[i]=num1;
            }else {
                i-=1;
            }
        }
        int max1=m1[0];
        for (int i = 1; i < m1.length; i++) {
            if(max1>m1[i]){
            }else{
                temp=m1[i];
                m1[i]=max1;
                max1=temp;
            }
        }
    }
}
